﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;

public partial class Admin_EditTicket : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            sdsTicketInfo.FilterExpression = "[TicketID]=" + Request.QueryString["id"].ToString();
            DataView dv = new DataView();
            dv = (DataView)sdsTicketInfo.Select(DataSourceSelectArguments.Empty);
            DataRowView drv = dv[0];
            DropDownList1.SelectedValue = drv["TicketStatus"].ToString(); 
        }
    }
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        String status = DropDownList1.SelectedValue.ToString();
        String ticketID = Request.QueryString["id"].ToString();
        TicketBAL obj = new TicketBAL();
        bool result = obj.changeTicketStatus(status, ticketID);
        if (result == true)
        {
            Label1.Text = "Update successfull";
            Response.Redirect("~/Admin/TicketList.aspx");
        }
        else
            Label1.Text = "Erorr";
    }
}